<?php
    class maytinhbs
    {
        public $MaSanPham = 0;
        public $TenSanPham = '';
		public $GiaGoc	= 0;
		public $GiaKhuyenMai = 0;
        public $SoLuong = 1;
        public $NgayNhap = '';
		public $HinhNho	= '';
        public $HinhTo	= '';
		public $TomTat	= 0;
		public $ChiTiet	= 0;
		public $MaLoai	= '';
        
        //Phân trang
        public $SoSanPham = 6;
        public $P = 1;
        
        public function GetListInCart($masanpham = '')
		{
			$db = new maytinhdb();
			return $db->GetListInCart($masanpham);
		}
		
		public function GetNumListInCart($masanpham = '')
		{
			$db = new maytinhdb();
			return $db->GetNumListInCart($masanpham);
		}
        
        public function Add()
		{
			$db = new maytinhdb();
			return $db->Add($this->TenSanPham, $this->GiaGoc, $this->GiaKhuyenMai, $this->SoLuong, $this->NgayNhap, $this->HinhNho, $this->HinhTo, $this->TomTat, $this->ChiTiet, $this->MaLoai);
		}
        
        public function Update()
		{
			$db = new maytinhdb();
			return $db->Update($this->MaSanPham,$this->TenSanPham, $this->GiaGoc, $this->GiaKhuyenMai, $this->SoLuong, $this->NgayNhap, $this->HinhNho, $this->HinhTo, $this->TomTat, $this->ChiTiet, $this->MaLoai);
		}
        
        public function Delete()
        {
            $db = new maytinhdb();
            return $db->Delete($this->MaSanPham);
        }
        
        public function NumBerEnd()
        {
            $db = new maytinhdb();
            return $db->NumberEnd();
        }
        
        public function GetListComputer()
		{
			$db = new maytinhdb();
			return $db->GetListComputer($this->MaSanPham, $this->TenSanPham);
		}
        
        public function GetTypeListComputer()
		{
			$db = new maytinhdb();
			return $db->GetTypeListComputer();
		}
        
        public function GetListNewComputer()
		{
			$db = new maytinhdb();
			return $db->GetListNewComputer($this->SoSanPham);
		}
        
        public function GetListDealsComputer()
		{
			$db = new maytinhdb();
			return $db->GetListDealsComputer($this->SoSanPham);
		}
        
        public function GetListBuysComputer()
		{
			$db = new maytinhdb();
			return $db->GetListBuysComputer($this->SoSanPham);
		}
        
        public function SearchResult($giatu = 0, $dengia = 0, $order = '', $start = 0, $num = 30, $all = 0)
		{
			$db = new maytinhdb();
			return $db->SearchResult($this->TenSanPham, $this->TomTat, $this->MaLoai, $giatu, $dengia, $order, $start, $num, $all);
		}
        
        public function TotalPage()
        {
            $db = new maytinhdb();
			return $db->TotalPage($this->SoSanPham, $this->MaLoai);
        }
        
        public function Paging()
        {
            $db = new maytinhdb();
			return $db->Paging($this->SoSanPham, $this->P, $this->MaLoai);
        }
    }
?>